package com.leyuangame.core.websocket.handler;

import com.leyuangame.core.model.Game;
import com.leyuangame.core.model.GamePartion;
import com.leyuangame.utils.UKTools;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;

public class RoomInfo implements Serializable,Comparable<RoomInfo>{
    public String room_id;
    public GamePartion gamePartion;
    public Game game;
    public int start_number;
    public Date create_time;

    public ArrayList<BeiMiClient> getPlayers() {
        return players;
    }

    public void setPlayers(ArrayList<BeiMiClient> players) {
        this.players = players;
    }

    public ArrayList<BeiMiClient> players = new ArrayList<>();
    public RoomInfo(){
        super();
        this.room_id = UKTools.getUUID();
    }
    public RoomInfo(Game game,GamePartion gamePartion){
        this.room_id = UKTools.getUUID();
        this.game = game;
        this.gamePartion = gamePartion;
        this.start_number = game.startnumber;
        this.create_time = new Date();
    }
    public String getRoom_id() {
        return room_id;
    }

    public void setRoom_id(String room_id) {
        this.room_id = room_id;
    }

    public GamePartion getGamePartion() {
        return gamePartion;
    }

    public void setGamePartion(GamePartion gamePartion) {
        this.gamePartion = gamePartion;
    }

    public Game getGame() {
        return game;
    }

    public void setGame(Game game) {
        this.game = game;
    }

    public int getStart_number() {
        return start_number;
    }

    public void setStart_number(int start_number) {
        this.start_number = start_number;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    @Override
    public int compareTo(RoomInfo o) {
        if(this.room_id.equals(o.room_id))
            return 0;
        if(this.players.size()>o.players.size()){
            return -1;
        }
        return 1;
    }
}
